{% extends 'base.html' %}
{% load staticfiles %}
{% block title %}
    更新文章
{% endblock %}
{% block content %}
    <div class="container">
        <div class="row">
            <div class="col-12">
                <br>
                <form action="." method="post">
                    {% csrf_token %}
                    <div class="form-group">
                        <label for="title">
                            文章标题
                        </label>
                        <input type="text" class="form-control" id="title" name="title" value="{{ article.title }}">
                    </div>
                    <div class="form-group">
                        <label for="column">栏目</label>
                        <select class="form-control"
                                id="column"
                                name="column"
                        >
                            <option value="none">请选择栏目..</option>
                            {% for column in columns %}
                                <option value="{{ column.id }}"
                                        {% if column.id == article.column.id %}
                                        selected
                                        {% endif %}
                                >
                                    {{ column }}
                                </option>
                            {% endfor %}
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="body">
                            文章正文
                        </label>
                        <!--textarea标签要写在一行，否则编辑页面会出现在该区域中出现大量空格的现象-->
                        <textarea type="text" class="form-control" id="body" name="body"
                                  rows="12">{{ article.body }}</textarea>
                    </div>
                    <button type="submit" class="btn btn-primary">完成</button>
                </form>
            </div>
        </div>
    </div>
{% endblock %}